{include file="general/header.tpl"}
<div id="path">
	You are here: <a href="index.php">Home</a> &raquo; <a href="login.php">Login</a>
</div>
<div id="main">
	{validate form="login" id="v_username_empty" append="error" message="Username cannot be empty."}
	{validate form="login" id="v_password_empty" append="error" message="Password cannot be empty."}
	{if $login_button}
		<div class="failed">
			{assign var="session_name" value=#SessionName#}
			{if !$smarty.cookies.$session_name}
				Either your session has expired or you have to accept cookies from this site before using it.<br />
			{/if}
			{if $username && $password}
				{if !$user_valid}
					{assign var="custom_error" value="true"}
					Bad username or invalid password.<br />
				{elseif $user->isBlocked()}
					{assign var="custom_error" value="true"}
					Your account has been blocked by an administrator.<br />
				{elseif !$user->isActivated()}
					{assign var="custom_error" value="true"}
					Your account has to be activated in order to sign in.<br />
				{/if}
			{/if}
			{foreach $error as $message}
				{$message}<br />
			{foreachelse}
				{if !$custom_error}
					An unknown session error occured. Do not refresh the page or submit the form, just click again on the link that brought you to this page to create a new session.<br />
				{/if}
			{/foreach}
		</div>
	{/if}
	<h1>Login</h1>
	<form action="" method="post">
		<div class="form-field">
			<label>Username:</label>
			<input type="text" name="username" value="{$username|escape}" class="std-field-width" />
		</div>
		<div class="form-field">
			<label>Password:</label>
			<input type="password" name="password" value="" class="std-field-width" />
			<br /><br />
		</div>
		<div class="form-field">
			<label>&nbsp;</label>
			<input type="submit" name="login_button" value="Login" />
		</div>
	</form>
</div>
<script type="text/javascript">
	document.forms[0].username.focus();
</script>
{include file="general/left.tpl"}
{include file="general/footer.tpl"}